*     *****************************************************************   *;
*     *****************************************************************   *; 
*   Date:          December 27, 2021                               	      *;
*   Authors:       Lisa Dellmuth and Jonas Tallberg				          *;   
*   Purpose: 	   Analyses for book Legitimacy Politics: Elite  		  *;
*    Communication and Public Opinion in Global Governance (CUP, 2023)    *;
*     ****************************************************************    *;
*     ****************************************************************    *;


***********************
* create WVS7 figure across IOs
***********************


* mean in WVS7 dataset of 45 countries in which confidence question was asked, May 2020 release 	 

use "WVS_Cross-national_Wave_7_Stata_v20200502.dta", clear

svyset [pweight=S018], strata(B_COUNTRY)

tab Q88
tab Q88, nol
rename Q88 confWHO
rename Q89 confWTO
rename Q87 confWB
rename Q83 confUN
rename Q84 confIMF
rename Q85 confICC
rename Q86 confNATO
rename Q71 confgov

recode confWTO  -4/-1=. 1=1 2=1 3=0 4=0
recode confWHO  -4/-1=. 1=1 2=1 3=0 4=0
recode confIMF -4/-1=. 1=1 2=1 3=0 4=0
recode confUN -4/-1=. 1=1 2=1 3=0 4=0
recode confWB -4/-1=. 1=1 2=1 3=0 4=0
recode confICC -4/-1=. 1=1 2=1 3=0 4=0
recode confNATO -4/-1=. 1=1 2=1 3=0 4=0
recode confgov  -4/-1=. 1=1 2=1 3=0 4=0

sum confUN confIMF confICC confWB confWHO confWTO confNATO confgov

label drop _all

collapse (mean) confgov confUN-confWTO [pweight=S018], by(B_COUNTRY) 

ed

reshape long conf, i(B_COUNTRY) j(inst, string)

replace inst="Gov." if inst=="gov"  

set scheme plotplain

graph bar conf, over(inst, sort(conf) descending) ///
ylabel(0 "0%" .20 "20%" .40 "40%" .60 "60%" .80 "80%" 1.00 "100%", labsize(small) angle(horizontal) ///
glcolor(gs14) gmax) bar(3, color(g2)) ytitle("% quite a lot or a great deal of confidence") ylabel(,gstyle(minor)) legend(off) 









